﻿using Aliphant.Common.Caches;
using Aliphant.Tool.ExcelToJson.Helpers;
using Aliphant.Tool.ExcelToJson.Interface;
using Aliphant.Tool.ExcelToJson.Models;
using System.Data;

namespace Aliphant.Tool.ExcelToJson.Impl
{
    internal class ExcelReader : IReader
    {
        public void Read(string filePath)
        {
            try
            {
                IDictionary<string, DataTable>? list = ExcelHelper.ReadToDataTable(filePath);
                PublicCache.Instance.Add(Constants.CacheDataTable, list);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            finally
            {

            }
        }
    }
}
